home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_perl.idb / usr / freeware / catman / p_man / cat3 / re.Z / re
Encoding:
Text File  |  1998-10-28  |  3.8 KB  |  133 lines

  1.  
  2.  
  3.  
  4.      rrrreeee((((3333))))         22223333////OOOOcccctttt////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))         rrrreeee((((3333))))
  5.  
  6.  
  7.  
  8.      NNNNAAAAMMMMEEEE
  9.       re - Perl pragma to alter regular expression behaviour
  10.  
  11.      SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.           use re 'taint';
  13.           ($x) = ($^X =~ /^(.*)$/s);     # $x is tainted here
  14.  
  15.           $pat = '(?{ $foo = 1 })';
  16.           use re 'eval';
  17.           /foo${pat}bar/;             # won't fail (when    not under -T switch)
  18.  
  19.           {
  20.           no re    'taint';         # the default
  21.           ($x) = ($^X =~ /^(.*)$/s); # $x is not tainted here
  22.  
  23.           no re    'eval';             # the default
  24.           /foo${pat}bar/;         # disallowed (with    or without -T switch)
  25.           }
  26.  
  27.           use re 'debug';             # NOT lexically scoped (as    others are)
  28.           /^(.*)$/s;             # output debugging    info during
  29.                          #       compile and run time
  30.  
  31.           use re 'debugcolor';         # same as 'debug',    but with colored output
  32.           ...
  33.  
  34.       (We use $^X in these examples    because    it's tainted by
  35.       default.)
  36.  
  37.      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  38.       When use re 'taint' is in effect, and    a tainted string is
  39.       the target of    a regex, the regex memories (or    values
  40.       returned by the m// operator in list context)    are tainted.
  41.       This feature is useful when regex operations on tainted data
  42.       aren't meant to extract safe substrings, but to perform
  43.       other    transformations.
  44.  
  45.       When use re 'eval' is    in effect, a regex is allowed to
  46.       contain (?{ ... }) zero-width    assertions even    if regular
  47.       expression contains variable interpolation.  That is
  48.       normally disallowed, since it    is a potential security    risk.
  49.       Note that this pragma    is ignored when    the regular expression
  50.       is obtained from tainted data, i.e.  evaluation is always
  51.       disallowed with tainted regular expresssions.     See the
  52.       section on (?{ _c_o_d_e }) in the    _p_e_r_l_r_e manpage.
  53.  
  54.       For the purpose of this pragma, interpolation    of precompiled
  55.       regular expressions (i.e., the result    of qr//) is _n_o_t
  56.       considered variable interpolation.  Thus:
  57.  
  58.           /foo${pat}bar/
  59.  
  60.  
  61.  
  62.  
  63.      Page 1                        (printed 10/23/98)
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.      rrrreeee((((3333))))         22223333////OOOOcccctttt////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))         rrrreeee((((3333))))
  71.  
  72.  
  73.  
  74.       _i_s allowed if    $pat is    a precompiled regular expression, even
  75.       if $pat contains (?{ ... }) assertions.
  76.  
  77.       When use re 'debug' is in effect, perl emits debugging
  78.       messages when    compiling and using regular expressions.  The
  79.       output is the    same as    that obtained by running a
  80.       -DDEBUGGING-enabled perl interpreter with the    ----DDDDrrrr switch. It
  81.       may be quite voluminous depending on the complexity of the
  82.       match.  Using    debugcolor instead of debug enables a form of
  83.       output that can be used to get a colorful display on
  84.       terminals that understand termcap color sequences.  Set
  85.       $ENV{PERL_RE_TC} to a    comma-separated    list of    termcap
  86.       properties to    use for    highlighting strings on/off, pre-point
  87.       part on/off. See the section on _D_e_b_u_g_g_i_n_g _r_e_g_u_l_a_r
  88.       _e_x_p_r_e_s_s_i_o_n_s in the _p_e_r_l_d_e_b_u_g manpage for additional info.
  89.  
  90.       The directive    use re 'debug' is _n_o_t _l_e_x_i_c_a_l_l_y    _s_c_o_p_e_d,    as the
  91.       other    directives are.     It has    both compile-time and run-time
  92.       effects.
  93.  
  94.       See the section on _P_r_a_g_m_a_t_i_c _M_o_d_u_l_e_s in the _p_e_r_l_m_o_d_l_i_b
  95.       manpage.
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.      Page 2                        (printed 10/23/98)
  130.  
  131.  
  132.  
  133.